#include "picturepuzzleitem.h"
#include <random>    // C++11随机数库
#include <algorithm> // 用于shuffle

PicturePuzzleItem::PicturePuzzleItem(QWidget *p , int mapSize)
    :QWidget(p)
    ,m_mapSize(mapSize)
{
}

bool PicturePuzzleItem::isRight()
{
    return m_targetPosX == m_curPosX && m_targetPosY == m_curPosY;
}

void PicturePuzzleItem::init(QPixmap *p, int num)
{
    m_pixmap = p;
    m_targetPosX = num % m_mapSize;
    m_targetPosY = num / m_mapSize;
}

void PicturePuzzleItem::setCurPos(int num)
{
    m_curPosX = num % m_mapSize;
    m_curPosY = num / m_mapSize;
}

void PicturePuzzleItem::updata()
{

}

